import Card from "./Card";
import React from "react";
import {TypeCaptain} from "@/shared/types";

type FerryProps = {
    id: number;
    name: string;
    image: string;
    ferry_type: string;
    passenger_capacity: number;
    vehicle_capacity: number;
    captain: TypeCaptain;
};

export default function FerryCard(
    {
        id,
        name,
        image,
        ferry_type,
        passenger_capacity,
        vehicle_capacity,
        captain
    }: FerryProps) {
    const details = (
        <>
            <p><strong>Тип:</strong>{ferry_type}</p>
            <p>
                <strong>Вместимость:</strong>Пассажиры: {passenger_capacity} мест. {vehicle_capacity > 0  && `Транспорт ${vehicle_capacity} мест.`}
            </p>
            <p>
                <strong>Капитан:</strong> {captain ? `${captain.last_name} ${captain.first_name} ${captain.patronymic}` : "Без капитана"}
            </p>
        </>
    );

    return (
        <Card
            id={id}
            name={name}
            image={image}
            details={details}
            link={`/admin/ships/${id}?id=${id}`}
        />
    );
}
